package com.trkj;


import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 * Hello world!
 *
 */
public class App 
{
   private static Logger Logger= LogManager.getLogger(App.class);

   public  static void main(String[] args){

       try {
           Connection connection = ConnectionFactory.getDatabaseConnection();
           Statement statement = connection.createStatement();
           ResultSet resultSet = statement.executeQuery("SELECT * FROM sys_log");

           while (resultSet.next()) {
               // 从结果集中获取数据并进行处理
               int id = resultSet.getInt("log_id");
               String name = resultSet.getString("log_file");
               // 其他字段类似获取
               Logger.fatal("系统崩了。。。。");
               // 处理数据，例如打印输出
               System.out.println("ID: " + id + ", Name: " + name);
           }

           resultSet.close();
           statement.close();
           connection.close();
       } catch (SQLException e) {
           e.printStackTrace();
       } catch (Exception e) {
           throw new RuntimeException(e);
       }
   }
}
